#ifndef _TRAFFIC_SIMULATION_H_
#define _TRAFFIC_SIMULATION_H_


/* name of configuration file */
#define CONFIG_FILE				"trafficSimulator.conf"

/* thread stack size */
#define STACK_SIZE	200 * 1024

/* speed multipliers */
#define HALF		0.5
#define DOUBLE		2.0

/* key string identifiers */
#define KEY_NUM_BLOCKS_X 		"NUM_BLOCKS_X"
#define KEY_NUM_BLOCKS_Y		"NUM_BLOCKS_Y"
#define KEY_BLOCK_SIZE_X		"BLOCK_SIZE_X"
#define KEY_BLOCK_SIZE_Y		"BLOCK_SIZE_Y"
#define KEY_INIT_CARS			"INIT_CARS"
#define KEY_INIT_SEMAPHORES		"INIT_SEMAPHORES"
#define KEY_SEM_TIME			"SEM_TIME"

/* default values in case it is not specified */
#define DEF_NUM_BLOCKS_X 		9
#define DEF_NUM_BLOCKS_Y		9
#define DEF_BLOCK_SIZE_X		2
#define DEF_BLOCK_SIZE_Y		2
#define DEF_INIT_CARS			5
#define DEF_INIT_SEMAPHORES		5
#define DEF_SEM_TIME			5

/* enumeration of config keys */
enum CONF_KEY{NUM_BLOCKS_X, NUM_BLOCKS_Y, BLOCK_SIZE_X, 
	BLOCK_SIZE_Y, INIT_CARS, INIT_SEMAPHORES, NUM_CONF_KEYS};


/* set signals handlers */
void setSignalCatcher(void);

/* create instances of objects needed to start the simulation */ 
void initSimulation(void);

/* read and process input while simulation is running */ 
void simulate(void);

/* stop simulation and quit program */
void finishSimulation(int a);

/* initialize config administration object */
void initConfig(void);

/* initialize output drawer thread */
void initOutput(void);

/* initialize city object */
void initCity();

/* initialize cars object */
void initCars(void);

/* initialize semaphores object */
void initSemaphores(void);

/* free memory of all objects created */ 	
void exitSimulation(void);

/* process input and change the simulation stage */
void processInput(int cmd);

#endif
